<include file="Public:header" />
<div id="zoneHeader">
    <h2>计费服务器进度</h2>
    <ul>
        <li><a href="?c=CostServer&a=add" class="btn">增加服务器</a></li>
    </ul>
</div><!--/#zoneHeader-->
<div id="zoneBody">
    <div id="zoneBodySearch">
        <form id="formSearch" action="?c={$Think.const.CONTROLLER_NAME}">
            <input type="hidden" name="sort" />
            <input type="hidden" name="sortdir" />

            <ul>
                <li><b>从服务器IP：</b><input type="text" name="slave_ip" class="fW150p" /></li>
                <li><button type="button" id="as" class="btnSearch">查询</button></li>
                <li><button type="button" class="btnResetForm">清空表单</button></li>
            </ul>
        </form>
    </div><!--/#zoneBodySearch-->
    <div id="zoneBodyContent">
        <table class="table2">
            <thead>
                <tr>
                    <th class="tAr">编号</th>
                    <th class="tAr">从服务器IP</th>
                    <th class="tAr">计费所处日期</th>
                    <th class="tAr">计费所处时间</th>
                    <th class="tAr">待计费时间段</th>
                    <th class="tAr">最后更新数据时间</th>
                    <th>状态</th>
                    <th class="tAl">操作</th>
                </tr>
            </thead>
            <tbody>
                <volist name="page.record" id="vo">
                <tr class="tAr">
                    <td>{$vo.id}</td>
                    <td>{$vo.slave_ip}</td>
                    <td>{$vo.cost_day}</td>
                    <td>{$vo.cost_time}</td>
                    <td><div t="wait_cost_time" ip="{$vo.slave_ip}"></div></td>
                    <td>{$vo.last_change_time}</td>
                    <td class="tAl">{$vo.status|getCostServerStatusCn}</td>
                    <td class="tAl">
                        <a href="?c=CostServer&a=modify&id={$vo.id}">编辑</a>
                        <a href="?c=CostServer&a=del&id={$vo.id}" t="firm" m="确认删除此计费服务器吗？">删除</a>
                    </td>
                </tr>
                </volist>
            </tbody>
        </table>
    </div><!--/#zoneBodyContent-->
</div><!--/#zoneBody-->
<script type="text/javascript">
$(function(){
    $('[t=wait_cost_time]').each(function(k, v) {
        var $o = $(v),
            ip = $o.attr('ip'),
            url = 'http://' + ip + ':811/ck/Api/getClickStreamIndex.php?callback=?',
            html = '';

        $.getJSON(url, function(j) {
            if (!j.s) {
                return false;
            }

            $.each(j.d, function(k2, v2) {
                html += '<p>' + v2 + '</p>';
            });

            $o.html(html);
        })
    });
})
</script>
<div id="zoneFooter">{:W('Page/info', [$page])}</div><!--/#zoneFooter-->
<include file="Public:footer" />
